/***************************************************************************
 *   Copyright (C) 2008 by JBox systems
 *   gabi@shaargiora.co.il
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 ***************************************************************************/

#pragma once

#include <string>
#include <map>
#include <vector>

/**
	Version URL list.

	Loads urls for application versions from file.

	@author Shaar Gabriel <gabi@jbox-comp.com>
*/
class VersionURLS {

	private:
		std::map<std::string, std::string> m_urls; /// URLs for application versions.

	public:

		/**
			Get url for given version.

			Throws NoUrl if no url found for given version.

			@param version version to get url for.
			@return url for given version.
		*/
		std::string url(std::string version);

		/**
			Load urls from given file.

			File MUST contain lines of the form : version url

			@param filename File to load urls from.
		*/
		void load(const std::string filename);

		/**
			Get all versions with urls.

			@return list of versions.
		*/
		std::vector<std::string> versions();

		std::map<std::string, std::string> urls() const { return m_urls; }

};
